﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="Microsoft.Windows.Controls.Testing.TagEditor">
    <Grid x:Name="Root">
        <Border Padding="10" Width="420" VerticalAlignment="Center" Background="#11000000" BorderThickness="2" BorderBrush="#C0000000">
            <StackPanel x:Name="pnlEditor" VerticalAlignment="Center">
                <StackPanel.Resources>
                    <Style TargetType="Button" x:Key="TagButton">
                        <Setter Property="FontSize" Value="10" />
                        <Setter Property="FontFamily" Value="Courier New" />
                        <Setter Property="Margin" Value="15 0 0 0" />
                        <Setter Property="HorizontalAlignment" Value="Left" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Button">
                                    <StackPanel x:Name="TemplateRoot" Cursor="Hand">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup>
                                                <VisualState x:Name="Normal" />
                                                <VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TemplateRoot" Storyboard.TargetProperty="Background">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <SolidColorBrush Color="LightGray" />
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <ContentPresenter Content="{TemplateBinding Content}" />
                                    </StackPanel>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </StackPanel.Resources>
                
                <TextBlock Text="This UI allows you to provide tag expressions for filtering which tests are run." TextWrapping="Wrap" FontSize="10" />
                
                <StackPanel x:Name="pnlAutoRun" Orientation="Horizontal" HorizontalAlignment="Center" Margin="2" Background="Yellow">
                    <TextBlock Text="Auto-Run in " FontSize="11" Foreground="Gray" />
                    <TextBlock x:Name="txtTime" FontSize="11" />
                    <TextBlock Text="s..." FontSize="11" Foreground="Gray" />
                </StackPanel>
                
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                    <TextBlock Text="Tag:  " FontSize="12" />
                    <TextBox x:Name="txtTag" GotFocus="OnTagTouched" Width="360" FontFamily="Courier New" />
                </StackPanel>
                <Button Content="Run Tests" Click="OnRunClicked" HorizontalAlignment="Right" Margin="2" />
                
                <StackPanel x:Name="pnlHistory" Margin="0 0 0 10">
                    <TextBlock Text="History:" FontSize="10" />
                </StackPanel>
                
                <StackPanel>
                    <TextBlock Text="Examples:" FontSize="10" />
                    <Button Content="All" ToolTipService.ToolTip="Run all unit tests" Style="{StaticResource TagButton}" Click="OnTagButtonClicked" />
                    <Button Content="WrapPanelTest" ToolTipService.ToolTip="Run the unit tests in the WrapPanelTest class"  Style="{StaticResource TagButton}" Click="OnTagButtonClicked" />
                    <Button Content="WrapPanelTest-DP" ToolTipService.ToolTip="Run the unit tests in the WrapPanelTest class except those tagged with DP" Style="{StaticResource TagButton}" Click="OnTagButtonClicked" />
                    <Button Content="WrapPanelTest+DockPanelTest" ToolTipService.ToolTip="Run the unit tests in both the WrapPanelTest and DockPanelTest classes" Style="{StaticResource TagButton}" Click="OnTagButtonClicked" />
                    <Button Content="(WrapPanelTest+DockPanelTest)-DP" ToolTipService.ToolTip="Run the unit tests in both the WrapPanelTest and DockPanelTest classes except those tagged with DP" Style="{StaticResource TagButton}" Click="OnTagButtonClicked" />
                    <Button Content="WrapPanelTest*DP" ToolTipService.ToolTip="Run the unit tests in the WrapPanelTest class that are also tagged with DP" Style="{StaticResource TagButton}" Click="OnTagButtonClicked" />
                    <Button Content="!DP" ToolTipService.ToolTip="Run all unit tests except those tagged with DP" Style="{StaticResource TagButton}" Click="OnTagButtonClicked" />
                </StackPanel>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>